Skip to content

fix(scripts): emit 'Copied plan template' status in setup-plan.ps1 (parity with bash)#3198

Merged
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/ps-setup-plan-copied-message-parity
Jun 29, 2026
Merged

fix(scripts): emit 'Copied plan template' status in setup-plan.ps1 (parity with bash)#3198
mnriem merged 1 commit into
github:mainfrom
jawwad-ali:fix/ps-setup-plan-copied-message-parity

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

Description

setup-plan.sh prints a status message after copying the plan template on a fresh run:

cp "$TEMPLATE" "$IMPL_PLAN"
if $JSON_MODE; then echo "Copied plan template to $IMPL_PLAN" >&2
else echo "Copied plan template to $IMPL_PLAN"; fi

The PowerShell twin setup-plan.ps1 emitted nothing on the successful-copy path — only the Plan already exists skip message and the Plan template not found warning had equivalents. So on a first run the two scripts had a divergent status-output contract (the bash behavior is even covered by a test, test_setup_plan_json_parseable_on_first_run, which asserts Copied plan template on stderr).

Fix

Emit the same message after WriteAllText, routed exactly like the sibling Plan already exists message — [Console]::Error.WriteLine in -Json mode so stdout stays pure JSON, Write-Output in text mode. Mirrors the bash wording and stream routing. One source file.

Testing

  • uvx ruff check clean; tests/test_ps1_encoding.py green (edited .ps1 stays ASCII / PowerShell 5.1-safe).
  • New test_ps_setup_plan_copied_message_on_stderr_in_json_mode mirrors the existing bash test_setup_plan_json_parseable_on_first_run: asserts -Json first-run stdout is parseable JSON and Copied plan template is on stderr.
  • Verified fail-before / pass-after locally with Windows PowerShell 5.1: before, stderr is empty and the test fails; after, the message is on stderr and stdout remains pure JSON ({...,"BRANCH":""}). Existing setup-plan tests still pass.

AI Disclosure

  • I did use AI assistance (describe below)

Found and fixed with Claude Code (Claude Opus 4.8) under my direction. AI located the missing status message across the bash/PowerShell twins and drafted the fix plus a mirroring regression test; I confirmed the bash wording/stream routing, verified fail-before/pass-after under Windows PowerShell 5.1 (stdout stays pure JSON), and reviewed the diff before submitting.

…arity with bash)

setup-plan.sh prints 'Copied plan template to $IMPL_PLAN' after copying the template (to stderr in --json mode, stdout otherwise), but the PowerShell twin emitted nothing on the successful-copy path -- only the 'Plan already exists' skip message and the 'Plan template not found' warning existed. So the two scripts had a divergent status-output contract on a fresh run.

Emit the same message after WriteAllText, routed like the sibling skip message ([Console]::Error.WriteLine in -Json so stdout stays pure JSON, Write-Output in text mode). Mirrors the bash wording and stream routing exactly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns the PowerShell setup-plan.ps1 status-output behavior with the bash setup-plan.sh twin by emitting a “Copied plan template …” message on first-run successful template copy, while preserving “pure JSON on stdout” behavior in -Json mode.

Changes:

  • Emit “Copied plan template to …” after writing plan.md from the template in setup-plan.ps1, routed to stderr in -Json mode and stdout in text mode.
  • Add a regression test ensuring PowerShell -Json first-run output remains parseable JSON on stdout while the “Copied plan template” status message is emitted on stderr.
Show a summary per file
File Description
tests/test_setup_plan_no_overwrite.py Adds a PowerShell parity regression test for “Copied plan template” stderr status in -Json mode while keeping stdout JSON-only.
scripts/powershell/setup-plan.ps1 Emits the “Copied plan template …” status message after a successful template copy with stream routing matching the bash script’s contract.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Low

@mnriem mnriem merged commit 96f73d1 into github:main Jun 29, 2026
12 checks passed
@mnriem

mnriem commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

kanfil added a commit to tikalk/agentic-sdlc-spec-kit that referenced this pull request Jun 29, 2026
Merge 8 upstream PRs (github#3196, github#3197, github#3198, github#3199, github#3187, github#3210, github#3214,
github#3217) from b7e67f5..bbc5f17.

- Resolved 1 textual conflict in scripts/powershell/create-new-feature.ps1
  (fork's delegation block + upstream's ContainsKey fix)
- Applied ContainsKey('Number') fix to extension script
  create-new-feature-branch.ps1 (same bug as upstream github#3196)
- All other files auto-merged cleanly

Assisted-by: opencode (autonomous)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants